import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XyywCouponUsageRecordForm, XyywCouponUsageRecordQuery, XyywCouponUsageRecordVo } from '@/api/xyyw/model/couponUsageRecordModel';
import { request } from '@/utils/request';

// 查询优惠券使用记录列表
export function listCouponUsageRecord(query?: XyywCouponUsageRecordQuery) {
  return request.get<TableDataInfo<XyywCouponUsageRecordVo>>({
    url: '/xyyw/couponUsageRecord/list',
    params: query,
  });
}

// 查询优惠券使用记录详细
export function getCouponUsageRecord(usageId: number) {
  return request.get<R<XyywCouponUsageRecordVo>>({
    url: `/xyyw/couponUsageRecord/${usageId}`,
  });
}

// 新增优惠券使用记录
export function addCouponUsageRecord(data: XyywCouponUsageRecordForm) {
  return request.post<R<void>>({
    url: '/xyyw/couponUsageRecord',
    data,
  });
}

// 修改优惠券使用记录
export function updateCouponUsageRecord(data: XyywCouponUsageRecordForm) {
  return request.put<R<void>>({
    url: '/xyyw/couponUsageRecord',
    data,
  });
}

// 删除优惠券使用记录
export function delCouponUsageRecord(usageIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xyyw/couponUsageRecord/${usageIds}`,
  });
}
